Friday, March 27, 2009

Artificial Intelligence 101 - part 2

Why AI?

Now that we have established what Artificial Intelligence is, let's look at why we would want to create such a thing. There isn't much point in creating something if we don't know why we would need it at all. We already have natural intelligence - human beings. What sort of advantages do we gain by developing artificial intelligence?

intelligence in nature

To help us answer this question, we first need to know what intelligence is used for in nature. The physical implementation of intelligence in nature is performed by neurons, so it is safe to say that any creature without a nervous system is incapable of intelligence. The simplest animal with a nervous system is Caenorhabditis elegans, which has exactly 959 cells in its body. 302 of those cells are neurons. All the other bodily functions - digestion, respiration, excretion, reproduction, circulation, and locomotion - are handled by the remaining 657 cells. This is an enormous portion of the animal's body being used to sense its environment, make decisions, and trigger actions, more than 31 percent.

Clearly this control system is important to c. elegans survival. Its nervous system is a third of its body, and hence demands a third of its nutritional requirements. So, why is such a large nervous system worth so much to c. elegans? The animal needs to feed on bacteria, which are unlikely to be right in front of its mouth all the time, so it needs to find those nutrients and get to them. To do that, it needs to sense its environment and find and eat its food. It needs to move its body around up, down, left, and right through the soil. It needs to sense damage to its body and move to avoid the source of the damage if possible. And it needs to perform certain automatic functions within its body, such as flushing waste from its system. These behaviors and capabilities allow c. elegans to survive within its simple environment.

C. elegans has a nervous system. Does that mean that it has intelligence? Well, it certainly makes choices (left or right?). The environment provides it with immediate feedback, which then subtly modifies the connections between and firing patterns of neurons (and this makes c. elegans useful for the study of nicotine dependence). Finally, such properties are not inherent in a single neuron, but only emerge when a group of neurons work together. Therefore, according to the definition in part 1, c. elegans has intelligence. Not a lot, and not particularly smart, but it is there. It uses that intelligence to allow basic behaviors such as controlling movement.

If we look at some larger animals with more complex bodies and nervous systems, we start to see animals with brains - a localized cluster of an enormous number of interconnected neurons. At each evolutionary step, much of the structure of the brain is retained (as long as the parts remain useful) and new capabilities are added. These larger animals have more complicated environments than c. elegans, as they operate at a different physical scale. They are forced by evolution to add adaptations like predation and mating calls and so forth, each of which are controlled by new neural structures and combinations of structures in the brain.

Over a long period of time, those structures which enable survival spread as species evolve and diverge. For instance, we all have a portion of our brains which are "reptilian", inherited from a long-ago ancestor, which controls basic functions like rage or fight-or-flight. Human beings have a far more complicated brain structure than any other animal. While we have retained the reptilian brain, a lot more stuff has been added over evolutionary history. With each new addition, a new set of capabilities emerged as the new structure interacted with the preexisting structures.

This is true for all the macroscopic animals. Each has evolved over time, sharing some structures (both within the brain and within the rest of the body) from remote ancestors and sharing others only within their genus or species, or unique to the animal itself. Each new structure, when integrated with the old structures, provides new behaviors, such as flight or echolocation. Each contributes to the intelligence of the animal and hence the capabilities of the animal.

So, we have a partial answer: in nature, animals use intelligence to enable them to make choices and have various capabilities and behaviors which they would be unable to have without intelligence. And, we want to give our machines the ability to make choices and to have various capabilities and complex behaviors.

automation

Next, let's look at the "Artificial" part of AI. Although we could make our AI with any computational device (even Tinkertoys, Legos or Meccano), for simplicity we'll use computers. Whenever we create anything which performs some process in computer software and hardware, we are by definition automating that process. Why would we want to automate intelligence?

To help us answer this question, let's first look at some examples of automation. If we require some task to be done exactly the same way over and over, then it makes sense to build a machine to perform that task automatically. If we want to explore the surface of Mars, and it would be expensive and dangerous to send a manned mission first, then we send a machine to perform that task for us. If we want to control traffic signals, then it is far more efficient to automate the process, rather than having someone manually controlling all of the signals in a city. If we want to decelerate a vehicle on an icy road, then anti lock brakes automate the process of rapidly pressing and releasing the brakes much faster than any human can.

Human labor is expensive compared to automation. While it is possible for a team of people to control all of the traffic lights in a city, people get bored or sick or take vacations, and they need breaks for lunch and cannot work 24/7. A machine that controls the traffic signals can operate continuously, never takes a sick day, and never needs to be paid. Automation makes sense for that task, and indeed traffic lights have been automated everywhere. At first, the control systems were simple timers, but that can lead to problems like cars sitting at red lights for unnecessary lengths of time, poor synchronization between signals causing traffic jams, and so on. Over the years these systems have become more sophisticated, with pressure sensors embedded in the roadway monitoring traffic flow and providing feedback to the control system. Ideally, all of the traffic lights in a city would be operated in such a way to maximize the flow of traffic and minimize delays, saving all commuters time and gasoline. A control system with more intelligence controlling those lights would allow traffic to flow with fewer unnecessary red light delays and with a smoother flow than a simple timer system.

As machines become more complex, direct human control is possible only in the broadest sense. The driver of a car can steer, press the accelerator or brake pedal, operate the gear shift, and control the lights and signals to other drivers. The driver cannot directly control such things as the timing of the firing of the spark plugs, the fuel to air ratio, the angle of the steering wheels, how much power to apply to each wheel, and how much force to apply to each brake pad. On older cars, that was all handled by indirect mechanical means, which meant such things as skidding on icy roads or losing control in corners. On modern vehicles, those indirect controls are handled through the car's computer. Besides the control signals from the driver, these vehicles have additional sensors throughout the car, which monitor the car's environment and use that feedback to directly control the vehicle's wheels, steering and brakes. This layer of automation between driver and vehicle allows such things as anti lock brakes, traction control, and other features like airbags. Each of these systems improves the safety and efficiency of the vehicle, but requires simultaneous control of multiple systems many times per second. That is too much information to process, too many repetitive decision to be made, and too many things to control at once for a human driver, so the process has to be automated. The smarter the vehicle can be made, the greater the improvements in safety and efficiency - at least theoretically, assuming people don't make bad choices while driving.

What can we learn from these examples? Generally speaking, it is desirable to automate some function if it is too expensive, repetitive, tedious, complicated, or dangerous for humans to perform directly.

so, why AI?

A machine must be controlled in order to be useful, and without control a machine is dangerous - imagine an uncontrolled semi during rush hour. Some machines are simple, and simple software can be used to control them. Other machines, like the aforementioned semi, are more complicated and operate in a complex environment, and so (for now) they require human control.

Everything that is automated already has a control system. These range from simple mechanical controls (like a thermostat with a Mercury switch) to highly sophisticated electronic hardware and computer software. In nature, there is obviously a range of intelligence between species and within a species. It isn't a simple linear scale, as each new capability in effect provides another axis along which to measure intelligence - if a new application of intelligence isn't different in degree, then it is different in kind. And with automation there is obviously a range of intelligence required to operate our machines, with simple machines needing very little or no intelligence and more sophisticated and complicated machines requiring more complex control.

However, even the simplest of control systems can be improved with the application of artificial intelligence. Let's take the thermostat in your house as an example. In older thermostats, the furnace blower would come on if the temperature fell below a certain value and would turn off again above some other value. These values were determined by a set point on the dial; if it was a few degrees colder than the set point (moving the Mercury switch one way) then the furnace blower came on, and if it was a few degrees warmer than the set point (which would move the Mercury switch the other way), the furnace would shut off.

That isn't a particularly efficient way of operating the furnace, but it works. This can be improved, though, with some simple electronics and software. The problem being solved by the control system is well-understood and easily simulated. Causal relationships and the interrelationships between variables are well-understood and precise mathematical relationships can be derived and programmed into the control system software in the factory, long before actual use of the control system. Indeed, the vast majority of non-mechanical control systems do not use artificial intelligence, as much simpler PID controls will suffice. The Proportional/Integral/Derivative control system would allow for more precise adherence to the set point while using less energy to do so than the mechanical switch; indeed, PID controls are useful in an enormous range of applications and are ubiquitous.

In contrast, a fuzzy logic (this will be covered in AI101 part 5) control system on a thermostat allows for much smoother control of the furnace, turning the furnace blower on and off in a very slightly more efficient manner than PID. The gain in efficiency in use of the furnace can lower the heating bill by a significant amount. Of course, for trivial applications using an AI control system could be considered overkill. Most thermostats work just fine with a strictly mechanical control or PID control. If the cost of the AI control system is more than the savings due to the efficiency of using AI, then it doesn't make sense to use AI at all.

But what if the system being controlled changes over time? In that case, a mechanical or preprogrammed control system may not work properly and may act inappropriately. In such cases, the control system would need to recognize that its model of the system is in error and adapt its model by changing various constants it uses in its calculations - which brings us right back to the feedback part of the definition of artificial intelligence.

The thermostat has only two variables to deal with, the temperature and the set point. What if the system being controlled is not so well understood or easily simulated? What if there are a large number of variables whose interrelationships are nonlinear or otherwise unclear? It may not be possible to preprogram a control system in that case, and instead such a system needs artificial intelligence in order to learn those interrelationships.

And what if direct, real time human control is not possible? A robot can be sent to the bottom of the ocean, but seawater absorbs radio waves and so the robot must be tethered to the surface, and the robot cannot explore very far - and on its own, not at all. Robots have been sent to Mars, but the light-speed time delay forces ground controllers to guide the robots in small, incremental movements, and then wait three quarters of an hour for feedback - and those robots spend the vast majority of their working lives waiting through these light-speed communication delays. If instead the robot was equipped with an artificial intelligence that would allow it to safely maneuver about and do science on its own, then the ground controllers could give much more infrequent, general commands and spend most of their time downloading data.

bringing it all together

We want to control our machines so that they perform certain complex behaviors and possess certain capabilities, and for many applications simple control systems work just fine. However, if there are changes to the machine over time, if efficiency is at a premium, if the system is extremely complex or otherwise poorly understood, or if the environment is complex and changing over time, then we need artificial intelligence to get the desired behaviors from those machines.

In part three of AI101, we will look at some of the history of AI, from Golems to Dartmouth. Then in parts four, five, and six we'll look at some of the more promising strategies for developing artificial intelligence: neural networks, fuzzy logic, and genetic algorithms.

No comments: